<%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*,java.util.Random"%>

<HEAD>


	<script LANGUAGE="Javascript" SRC="Images/validate.js"></script>


	<LINK href="styles.css" type="text/css" rel="stylesheet">
<SCRIPT LANGUAGE="JavaScript">
	<!--
		function fnShowDetails(InterviewID,U)
			{
				var URL = U+"?InterviewID="+InterviewID;
				fnEmpPopUp(URL,600,600);
			}
	//-->
	</SCRIPT>
</HEAD>
<BODY class=Grad>
<%
int IAuth;
IAuth=(session.getAttribute("auth")==null) ? 10 :(Integer)session.getAttribute("auth");
if(IAuth==2){
%>
<P align=right><A href="AddNewInterview0.jsp" target="ResultFrame" ><img border="0"
	name="PostNewJob" src="Images/PostNewJob1.jpg" width="101" height="22" onmouseover="document['PostNewJob'].src='Images/PostNewJob0.jpg'" onmouseout="document['PostNewJob'].src='Images/PostNewJob1.jpg'" ></a><P>
<%
}
%>
<h2 align=center>View Jobs</h2>

<%
	Connection con=null;
	ResultSet rs=null;
	Statement stmt=null;
	try{
			
			
			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jobmiller","root","root");

			stmt =  con.createStatement();
			String Query = "Select * from InterviewDetails";
			Query += " order by InterviewID";
			System.out.println("Search Query:"+Query);
			rs = stmt.executeQuery(Query);
			%>
						<table align="center" width="60%">
							<tr class=row_title>
								<th align="Center" colspan=4>Job Details</th>
							</tr>
			<%
			int rCount=0;
			while(rs.next())
			{
						String  InterviewID		=rs.getString(1);
						String	JobTitle		=rs.getString(2);
						String	JobDescription	=rs.getString(3);
						String	Eligbility		=rs.getString(4);
						String	Location		=rs.getString(5);
						String	ApplyBefore		=rs.getString(6);
						String	CompanyName		=rs.getString(7);
						String	CompanyProfile	=rs.getString(8);
						String	EmailToApply	=rs.getString(9);
						String	WebSite			=rs.getString(10);
						String	ExecutiveName	=rs.getString(11);
						String	Address			=rs.getString(12);
						String	Telephone		=rs.getString(13);
						String	Fax				=rs.getString(14);
						String	DateOfPosting	=rs.getString(15);
						String	FunctionalArea	=rs.getString(16);
						String	MinExperience	=rs.getString(17);
						String  MaxExperience   =rs.getString(18);

						String Experience = MinExperience+"-"+MaxExperience;
						if(MinExperience.trim().equals(MaxExperience)){
							Experience = MinExperience;
						}
                
					%>
						<TR class= "row_odd">
							<th align="left">Job Id</th> 
							<th align=center><A onclick="fnShowDetails('<%=InterviewID%>','ShowInterview.jsp')"><B>&lt;&lt;<%=InterviewID%>&gt;&gt;</B></th>
							<td align="left" colspan=2><I><FONT SIZE="-1" COLOR="brown" face="Times new roman">click on Job Id to view details and to apply for the job</FONT></I></td> 
						</TR>
						<TR class= "row_even">
							<th align="left">Job Title</th> <td><%=JobTitle%></td><th align="left">Job Description</th> <td><%=JobDescription%></td>
						</TR>
						<TR class= "row_even">
							<th align="left">Company Name</th> <td><%=CompanyName%></td><th align="left">Date Of Posting</th><td><%=DateOfPosting%></td>
						</TR>
						<TR class= "row_even">
							<th align="left">Functional Area</th><td><%=FunctionalArea%></td><th align="left">Experience</th><td><%=Experience%> Years</td>
						</TR>
						<TR class= "row_even">
							<th align="center" colspan=4><HR color="#FF0099"></th>
						</TR>
					<%
				rCount++;
			}
			if( rCount == 0)	{%><tr class="row_odd">
										<th align="Center" colspan=4><FONT size="+1" Face="Times new roman" COLOR="#FF0099"><I>Sorry no jobs found, please modify your search criteria and try again</I></FONT></th>
								  </tr><% }
			rs.close();
			stmt.close();
			con.close();
		}catch(Exception e){
			rs.close();
			stmt.close();
			con.close();
			%><%=e%><%
		}
	
%>
</Table>

